<?php

// using
use \hpnWse\stStrUtil;
use \hpnWse\stObjUtil;
use \hpnWse\nWp\stBase as stWpBase;


// //【定制上传目录】
// $l_Optn_upload_path = get_option('upload_path');
// if (!$l_Optn_upload_path || ('wp-content/uploads' == $l_Optn_upload_path))
// {
//     update_option('upload_path', WP_CONTENT_DIR . '/' . '18337218804966445313782047024206');
// }

//【完全去除管理条，因为它会在html上施加外边距，从而影响排版】
show_admin_bar(false);

//【去除window._wpemojiSettings】
remove_action( 'admin_print_scripts',    'print_emoji_detection_script');
remove_action( 'admin_print_styles',    'print_emoji_styles');
remove_action( 'wp_head',        'print_emoji_detection_script',    7);
remove_action( 'wp_print_styles',    'print_emoji_styles');
remove_filter( 'the_content_feed',    'wp_staticize_emoji');
remove_filter( 'comment_text_rss',    'wp_staticize_emoji');
remove_filter( 'wp_mail',        'wp_staticize_emoji_for_email');

//【搜索限于文章】
add_filter('pre_get_posts','fSrchFltr');
function fSrchFltr($a_Qry)
{
    if ($a_Qry->is_search)
    {
        $a_Qry->set('post_type', 'post');
    }
    return $a_Qry;
}

//【文章格式支持，写文章时侧边栏会出现“形式”面板】
/*
* Enable support for Post Formats.
* See http://codex.wordpress.org/Post_Formats
*/
// add_theme_support( 'post-formats', 
// 	array(
// 		'aside', 'image', 'video', 'audio', 'quote', 'link', 'gallery'
// 	)
// );

//【文章缩略图】
if (function_exists('add_theme_support'))
{
	add_theme_support( 'post-thumbnails' );
}

//【摘要长度】
// 默认情况下，excerpt长度设置为55个字，可以使用excerpt_length过滤器改变excerpt的长度
function fExcpLen($length)
{
    return 130;
}
add_filter('excerpt_length', 'fExcpLen');

//【定制“[...]”】
function fExcpElps($more)
{
    return ' ...';
}
add_filter('excerpt_more', 'fExcpElps');

//【search.php】
function fChgSrchAmt($a_Qry) {
    if ( $a_Qry->is_search ) // Make sure it is a search page
    {
    	// Change 10 to the number of posts you would like to show
    	$a_Qry->query_vars['posts_per_page'] = 99;
	}
    return $a_Qry; // Return our modified query variables
}
add_filter('pre_get_posts', 'fChgSrchAmt'); // Hook our custom function onto the request filter

//【向仪表盘注册，告知有主导航菜单】
//register_nav_menu('primary', '主导航');

//【小工具支持】
// function mii_widgets_init() {
// 	register_sidebar( array(
// 		'name'          => __( 'Sidebar', 'mii' ),
// 		'id'            => 'sidebar-1',
// 		'description'   => __( 'Add widgets here to appear in your sidebar.', 'mii' ),
// 		'before_widget' => '<section id="%1$s" class="widget %2$s">',
// 		'after_widget'  => '</section>',
// 		'before_title'  => '<h2 class="widget-title">',
// 		'after_title'   => '</h2>',
// 	) );
// }
// add_action( 'widgets_init', 'mii_widgets_init' );


